[Interface]
PrivateKey = {{ wg_private_key }}
Address = {{ wireguard_ip }}/20
ListenPort = 51820
{% for host in hostvars %}
{% if hostvars[host]['is_primary']|bool %}
MTU = {{ wireguard_mtu | default(1380) }}

[Peer]
PublicKey = {{ hostvars[host]['wg_public_key'] }}
AllowedIPs = 192.168.0.0/20, 10.0.0.0/8
Endpoint = {{ hostvars[host]['external_ip'] }}:51820
PersistentKeepalive = 25
{% endif %}
{% endfor %}
